home *** CD-ROM | disk | FTP | other *** search
/ Symantec Visual Cafe for Java 2.5 / symantec-visual-cafe-2.5-database-dev-edition.iso / Visual Cafe Pro v1.0 / VISCAFE.BIN / ImageListBox.class (.txt) < prev    next >
Encoding:
Java Class File  |  1997-06-19  |  21.4 KB  |  1,600 lines

  1. package symantec.itools.awt;
  2.  
  3. import java.awt.Color;
  4. import java.awt.Component;
  5. import java.awt.Container;
  6. import java.awt.Dimension;
  7. import java.awt.Event;
  8. import java.awt.Font;
  9. import java.awt.FontMetrics;
  10. import java.awt.Graphics;
  11. import java.awt.Image;
  12. import java.awt.LayoutManager;
  13. import java.awt.Panel;
  14. import java.awt.Rectangle;
  15. import java.awt.Scrollbar;
  16. import java.awt.image.MemoryImageSource;
  17. import java.util.Vector;
  18. import symantec.itools.lang.OS;
  19.  
  20. public class ImageListBox extends Panel {
  21.    public static final int EVT_IMAGE_SELECT = 16388;
  22.    public static final int BORDER_REGULAR = 0;
  23.    public static final int BORDER_NONE = 1;
  24.    public static final int IMAGE_WIDTH = 19;
  25.    private final int LINE_SLOP;
  26.    protected int nTopRow;
  27.    protected int lWidth;
  28.    protected int cellHt;
  29.    protected int yAdj;
  30.    protected int borderWidth;
  31.    protected int halfBorderWidth;
  32.    private Component ilbParent;
  33.    private String ilbLabel;
  34.    private Image SelectImage;
  35.    private Scrollbar VBar;
  36.    private Scrollbar HBar;
  37.    private Vector items;
  38.    private Font font;
  39.    // $FF: renamed from: fm java.awt.FontMetrics
  40.    private FontMetrics field_0;
  41.    private boolean bAllDirty;
  42.    private boolean bMultipleSelections;
  43.    private boolean bBlockPaint;
  44.    private boolean bVBarVisible;
  45.    private boolean bHBarVisible;
  46.    private boolean bInternalBlockPaint;
  47.    private int rowsToShow;
  48.    private int colsToShow;
  49.    private int visibleRows;
  50.    private int visibleCols;
  51.    private int visibleIndex;
  52.    private int fontHeight;
  53.    private int fontDescent;
  54.    private int lastDownModifiers;
  55.    private int lastSelected;
  56.    private int lastIndex;
  57.    private int lastTempIndex;
  58.    private int countSelected;
  59.    private int borderType;
  60.    private int longestLineValue;
  61.    private int barSize;
  62.    private int xCoord;
  63.    private long prevSelectTime;
  64.    private long prevSelectRow;
  65.    private boolean bOsFlag;
  66.    private boolean bComboMode;
  67.    private boolean bCellBorders;
  68.    private boolean bAllowShowVBar;
  69.    private boolean bAllowShowHBar;
  70.    private Color enabledColor;
  71.    private Color disabledColor;
  72.    private int fastDownCount;
  73.    private boolean bMouseDrawHandled;
  74.    private boolean bDirectNotify;
  75.  
  76.    public ImageListBox() {
  77.       this((Component)null, "", -1, false);
  78.    }
  79.  
  80.    public ImageListBox(String var1) {
  81.       this((Component)null, var1, -1, false);
  82.    }
  83.  
  84.    public ImageListBox(String var1, boolean var2) {
  85.       this((Component)null, var1, -1, var2);
  86.    }
  87.  
  88.    public ImageListBox(String var1, int var2, boolean var3) {
  89.       this((Component)null, var1, var2, var3);
  90.    }
  91.  
  92.    public ImageListBox(Component var1, String var2) {
  93.       this(var1, var2, -1, false);
  94.    }
  95.  
  96.    public ImageListBox(Component var1, String var2, int var3, boolean var4) {
  97.       this.LINE_SLOP = 6;
  98.       this.yAdj = 6;
  99.       this.borderWidth = 4;
  100.       this.halfBorderWidth = 2;
  101.       this.bAllDirty = true;
  102.       this.bMultipleSelections = false;
  103.       this.bBlockPaint = false;
  104.       this.bVBarVisible = false;
  105.       this.bHBarVisible = false;
  106.       this.bInternalBlockPaint = false;
  107.       this.rowsToShow = -1;
  108.       this.colsToShow = 10;
  109.       this.visibleRows = -1;
  110.       this.visibleCols = -1;
  111.       this.visibleIndex = -1;
  112.       this.lastDownModifiers = -1;
  113.       this.lastSelected = -1;
  114.       this.lastIndex = -1;
  115.       this.lastTempIndex = -1;
  116.       this.barSize = 15;
  117.       this.prevSelectTime = -1L;
  118.       this.prevSelectRow = -1L;
  119.       this.bComboMode = false;
  120.       this.bCellBorders = false;
  121.       this.bAllowShowVBar = true;
  122.       this.bAllowShowHBar = true;
  123.       this.enabledColor = Color.black;
  124.       this.disabledColor = Color.gray;
  125.       this.bMouseDrawHandled = false;
  126.       this.bDirectNotify = true;
  127.       if (!System.getProperty("os.name").startsWith("S")) {
  128.          this.bOsFlag = false;
  129.          if (OS.isMacintosh()) {
  130.             this.barSize = 16;
  131.          } else {
  132.             this.barSize = 15;
  133.          }
  134.       } else {
  135.          this.bOsFlag = true;
  136.          this.barSize = 17;
  137.       }
  138.  
  139.       this.items = new Vector();
  140.       this.ilbParent = var1;
  141.       this.ilbLabel = var2;
  142.       this.rowsToShow = var3;
  143.       this.bMultipleSelections = var4;
  144.       byte var5 = 20;
  145.       byte var6 = 20;
  146.       int[] var7 = new int[var5 * var6];
  147.       int var8 = 0;
  148.  
  149.       for(int var9 = 0; var9 < var6; ++var9) {
  150.          for(int var10 = 0; var10 < var5; ++var10) {
  151.             var7[var8++] = -16777088;
  152.          }
  153.       }
  154.  
  155.       this.SelectImage = ((Component)this).createImage(new MemoryImageSource(var5, var6, var7, 0, var5));
  156.       ((Container)this).setLayout((LayoutManager)null);
  157.       ((Component)this).setBackground(Color.white);
  158.       this.VBar = new Scrollbar();
  159.       this.VBar.setBackground(Color.lightGray);
  160.       ((Container)this).add(this.VBar);
  161.       this.HBar = new Scrollbar(0);
  162.       this.HBar.setBackground(Color.lightGray);
  163.       ((Container)this).add(this.HBar);
  164.       this.setFont(new Font("Helvetica", 0, 12));
  165.    }
  166.  
  167.    public void setComboMode(boolean var1) {
  168.       this.bComboMode = var1;
  169.       this.yAdj = 6;
  170.       ((Component)this).invalidate();
  171.    }
  172.  
  173.    public boolean getComboMode() {
  174.       return this.bComboMode;
  175.    }
  176.  
  177.    public void setRowsToShow(int var1) {
  178.       this.rowsToShow = var1;
  179.       ((Component)this).invalidate();
  180.    }
  181.  
  182.    public int getRowsToShow() {
  183.       return this.rowsToShow;
  184.    }
  185.  
  186.    public void setShowVerticalScroll(boolean var1) {
  187.       if (this.bAllowShowVBar != var1) {
  188.          this.bAllowShowVBar = var1;
  189.          ((Component)this).invalidate();
  190.       }
  191.  
  192.    }
  193.  
  194.    public boolean getShowVerticalScroll() {
  195.       return this.bAllowShowVBar;
  196.    }
  197.  
  198.    public void setShowHorizontalScroll(boolean var1) {
  199.       if (this.bAllowShowHBar != var1) {
  200.          this.bAllowShowHBar = var1;
  201.          ((Component)this).invalidate();
  202.       }
  203.  
  204.    }
  205.  
  206.    public boolean getShowHorizontalScroll() {
  207.       return this.bAllowShowHBar;
  208.    }
  209.  
  210.    public void setBorderType(int var1) {
  211.       this.borderType = var1;
  212.       if (var1 == 0) {
  213.          this.borderWidth = 4;
  214.          this.halfBorderWidth = 2;
  215.       } else {
  216.          this.borderWidth = 0;
  217.          this.halfBorderWidth = 0;
  218.       }
  219.  
  220.       ((Component)this).invalidate();
  221.    }
  222.  
  223.    public int getBorderType() {
  224.       return this.borderType;
  225.    }
  226.  
  227.    public void setCellBorder(int var1, boolean var2) {
  228.       if (this.validIndex(var1)) {
  229.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  230.          if (var3.bCellBorder != var2) {
  231.             var3.bCellBorder = var2;
  232.             var3.bDirty = true;
  233.             ((Component)this).invalidate();
  234.          }
  235.       }
  236.  
  237.    }
  238.  
  239.    public void setCellBorders(boolean var1) {
  240.       this.bCellBorders = var1;
  241.       int var2 = this.items.size();
  242.       Object var3 = null;
  243.  
  244.       for(int var4 = 0; var4 < var2; ++var4) {
  245.          ListItem var5 = (ListItem)this.items.elementAt(var4);
  246.          var5.bCellBorder = var1;
  247.       }
  248.  
  249.       this.bAllDirty = true;
  250.       ((Component)this).invalidate();
  251.    }
  252.  
  253.    public boolean getCellBorders() {
  254.       return this.bCellBorders;
  255.    }
  256.  
  257.    public void setDefaultEnabledTextColor(Color var1) {
  258.       this.enabledColor = var1;
  259.       ((Component)this).invalidate();
  260.    }
  261.  
  262.    public Color getDefaultEnabledTextColor() {
  263.       return this.enabledColor;
  264.    }
  265.  
  266.    public void setDisabledTextColor(Color var1) {
  267.       this.disabledColor = var1;
  268.       ((Component)this).invalidate();
  269.    }
  270.  
  271.    public Color getDisabledTextColor() {
  272.       return this.disabledColor;
  273.    }
  274.  
  275.    public void setEnabledTextColor(int var1, Color var2) {
  276.       if (this.validIndex(var1)) {
  277.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  278.          var3.color = var2;
  279.       }
  280.  
  281.    }
  282.  
  283.    public boolean handleEvent(Event var1) {
  284.       int var5 = -1;
  285.       switch (var1.id) {
  286.          case 403:
  287.             if (var1.modifiers <= 1) {
  288.                switch (var1.key) {
  289.                   case 1000:
  290.                      var5 = this.keyCalcIndex(0, true);
  291.                      break;
  292.                   case 1001:
  293.                      var5 = this.keyCalcIndex(this.items.size() - 1, true);
  294.                      break;
  295.                   case 1002:
  296.                      var5 = this.keyCalcIndex(-this.visibleRows, false);
  297.                      break;
  298.                   case 1003:
  299.                      var5 = this.keyCalcIndex(this.visibleRows, false);
  300.                      break;
  301.                   case 1004:
  302.                      var5 = this.keyCalcIndex(-1, false);
  303.                      break;
  304.                   case 1005:
  305.                      var5 = this.keyCalcIndex(1, false);
  306.                }
  307.  
  308.                if (var5 != -1) {
  309.                   if (this.bMultipleSelections) {
  310.                      switch (var1.modifiers) {
  311.                         case 0:
  312.                            break;
  313.                         case 1:
  314.                            this.makeVisible(var5);
  315.                            this.shiftSelect(var5, false);
  316.                            return true;
  317.                         default:
  318.                            return true;
  319.                      }
  320.                   }
  321.  
  322.                   this.select(var5);
  323.                   ((Component)this).repaint();
  324.                   var1.x = -1;
  325.                   this.notifyParent(var1, var5, false);
  326.                   this.prevSelectTime = -1L;
  327.                   this.prevSelectRow = -1L;
  328.                   return true;
  329.                }
  330.             }
  331.             break;
  332.          case 501:
  333.             ++this.fastDownCount;
  334.             this.bMouseDrawHandled = false;
  335.             this.lastDownModifiers = var1.modifiers;
  336.             if (var1.x > -1 && var1.x < this.lWidth) {
  337.                var5 = this.mouseCalcIndex(var1.y);
  338.                if (var5 == -1) {
  339.                   return true;
  340.                }
  341.  
  342.                if (this.bMultipleSelections) {
  343.                   switch (this.lastDownModifiers) {
  344.                      case 1:
  345.                         this.bMouseDrawHandled = true;
  346.                         this.shiftSelect(var5, false);
  347.                         break;
  348.                      case 2:
  349.                         this.bMouseDrawHandled = true;
  350.                         this.ctrlSelect(var5);
  351.                         break;
  352.                      case 3:
  353.                         this.bMouseDrawHandled = true;
  354.                         this.shiftSelect(var5, true);
  355.                         break;
  356.                      default:
  357.                         this.select(var5);
  358.                   }
  359.  
  360.                   ((Component)this).repaint();
  361.                } else {
  362.                   this.lastTempIndex = var5;
  363.                   if (this.lastSelected == var5) {
  364.                      return true;
  365.                   }
  366.  
  367.                   this.select(var5);
  368.                   ((Component)this).repaint();
  369.                }
  370.             }
  371.  
  372.             return true;
  373.          case 502:
  374.             --this.fastDownCount;
  375.             if (this.bMouseDrawHandled) {
  376.                var1.x = -1;
  377.                this.notifyParent(var1, -1, false);
  378.                return true;
  379.             }
  380.  
  381.             if (!this.bMultipleSelections) {
  382.                var5 = this.mouseCalcIndex(var1.y);
  383.                if (var5 == -1 || var1.x < 0 || var1.x >= this.lWidth) {
  384.                   this.fastDownCount = 0;
  385.                   var5 = this.lastTempIndex;
  386.                   if (var5 == -1) {
  387.                      return true;
  388.                   }
  389.                }
  390.             }
  391.  
  392.             boolean var4;
  393.             if (this.bComboMode) {
  394.                this.fastDownCount = 0;
  395.                var4 = false;
  396.             } else if (this.fastDownCount > 0) {
  397.                this.fastDownCount = 0;
  398.                var4 = true;
  399.                this.prevSelectTime = -1L;
  400.                this.prevSelectRow = -1L;
  401.             } else {
  402.                long var2 = System.currentTimeMillis();
  403.                if (this.prevSelectTime != -1L && this.prevSelectRow == (long)var5 && this.prevSelectTime + 250L > var2) {
  404.                   var4 = true;
  405.                   this.prevSelectTime = -1L;
  406.                   this.prevSelectRow = -1L;
  407.                } else {
  408.                   var4 = false;
  409.                   this.prevSelectTime = var2;
  410.                   this.prevSelectRow = (long)var5;
  411.                }
  412.             }
  413.  
  414.             if (this.lastSelected != var5) {
  415.                this.select(var5);
  416.                ((Component)this).repaint();
  417.             }
  418.  
  419.             if (this.bMultipleSelections) {
  420.                this.notifyParent(var1, this.lastSelected, var4);
  421.                this.lastIndex = this.lastSelected;
  422.             } else {
  423.                this.notifyParent(var1, var5, var4);
  424.                this.lastIndex = var5;
  425.             }
  426.  
  427.             this.lastTempIndex = -1;
  428.             this.lastDownModifiers = -1;
  429.             return true;
  430.          case 503:
  431.             if (this.bMultipleSelections) {
  432.                break;
  433.             }
  434.          case 506:
  435.             if (var1.x > -1 && var1.x < this.lWidth) {
  436.                if (this.bComboMode) {
  437.                   var5 = this.mouseCalcIndex(var1.y);
  438.                   if (var5 == -1 || var5 == this.lastIndex) {
  439.                      return true;
  440.                   }
  441.  
  442.                   this.lastIndex = var5;
  443.                   this.select(var5);
  444.                   ((Component)this).repaint();
  445.                } else if (var1.id == 506) {
  446.                   var5 = this.mouseCalcIndex(var1.y);
  447.                   if (var5 != -1 && var5 != this.lastIndex) {
  448.                      if (this.bMultipleSelections) {
  449.                         if (this.lastDownModifiers != 0) {
  450.                            return false;
  451.                         }
  452.  
  453.                         this.bInternalBlockPaint = true;
  454.                         this.makeVisible(var5);
  455.                         this.bInternalBlockPaint = false;
  456.                         this.shiftSelect(var5, false);
  457.                      } else {
  458.                         this.select(var5);
  459.                      }
  460.  
  461.                      this.lastIndex = var5;
  462.                   }
  463.                }
  464.             }
  465.             break;
  466.          case 505:
  467.             if (!this.bMultipleSelections && this.bComboMode) {
  468.                this.lastIndex = -1;
  469.             }
  470.             break;
  471.          case 601:
  472.             if (var1.target == this.VBar) {
  473.                this.scrollVertical(var1.id, false);
  474.             } else {
  475.                this.scrollHorizontal(var1.id, false);
  476.             }
  477.             break;
  478.          case 602:
  479.             if (var1.target == this.VBar) {
  480.                this.scrollVertical(var1.id, false);
  481.             } else {
  482.                this.scrollHorizontal(var1.id, false);
  483.             }
  484.             break;
  485.          case 603:
  486.             if (var1.target == this.VBar) {
  487.                this.scrollVertical(var1.id, false);
  488.             } else {
  489.                this.scrollHorizontal(var1.id, false);
  490.             }
  491.             break;
  492.          case 604:
  493.             if (var1.target == this.VBar) {
  494.                this.scrollVertical(var1.id, false);
  495.             } else {
  496.                this.scrollHorizontal(var1.id, false);
  497.             }
  498.             break;
  499.          case 605:
  500.             if (var1.target == this.VBar) {
  501.                this.scrollVertical((Integer)var1.arg, true);
  502.             } else {
  503.                this.scrollHorizontal((Integer)var1.arg, true);
  504.             }
  505.       }
  506.  
  507.       return false;
  508.    }
  509.  
  510.    public synchronized void setMultiColumnMode(boolean var1) {
  511.       this.bComboMode = false;
  512.       this.yAdj = 2;
  513.       this.setBorderType(1);
  514.       this.setCellBorders(var1);
  515.    }
  516.  
  517.    public synchronized void addItem(String var1) {
  518.       this.addItem(new ListItem((Image)null, var1, true, this.field_0, this.bCellBorders));
  519.    }
  520.  
  521.    public void setListItems(String[] var1) {
  522.       this.clear();
  523.  
  524.       for(int var2 = 0; var2 < var1.length; ++var2) {
  525.          this.addItem(var1[var2]);
  526.       }
  527.  
  528.    }
  529.  
  530.    public String[] getListItems() {
  531.       int var1 = this.countItems();
  532.       String[] var2 = new String[var1];
  533.  
  534.       for(int var3 = 0; var3 < var1; ++var3) {
  535.          var2[var3] = this.getItem(var3);
  536.       }
  537.  
  538.       return var2;
  539.    }
  540.  
  541.    public synchronized void addItem(String var1, boolean var2) {
  542.       this.addItem(new ListItem((Image)null, var1, var2, this.field_0, this.bCellBorders));
  543.    }
  544.  
  545.    public synchronized void addItem(Image var1, String var2) {
  546.       this.addItem(new ListItem(var1, var2, true, this.field_0, this.bCellBorders));
  547.    }
  548.  
  549.    public synchronized void addItem(Image var1, String var2, boolean var3) {
  550.       this.addItem(new ListItem(var1, var2, var3, this.field_0, this.bCellBorders));
  551.    }
  552.  
  553.    public synchronized void addItem(Image var1, String var2, boolean var3, Color var4) {
  554.       ListItem var5 = new ListItem(var1, var2, var3, this.field_0, this.bCellBorders);
  555.       var5.color = var4;
  556.       this.addItem(var5);
  557.    }
  558.  
  559.    private void addItem(ListItem var1) {
  560.       this.items.addElement(var1);
  561.       this.updateWidth(var1);
  562.       if (!this.bInternalBlockPaint) {
  563.          ((Component)this).repaint();
  564.       }
  565.  
  566.    }
  567.  
  568.    public synchronized void insertItem(int var1, Image var2, String var3, boolean var4) {
  569.       Object var5 = null;
  570.       ListItem var6;
  571.       if (this.validIndex(var1)) {
  572.          this.items.insertElementAt(var6 = new ListItem(var2, var3, var4, this.field_0, this.bCellBorders), var1);
  573.          this.bAllDirty = true;
  574.          if (this.lastSelected >= var1) {
  575.             ++this.lastSelected;
  576.          }
  577.       } else {
  578.          this.items.addElement(var6 = new ListItem(var2, var3, var4, this.field_0, this.bCellBorders));
  579.       }
  580.  
  581.       this.updateWidth(var6);
  582.       if (!this.bInternalBlockPaint) {
  583.          ((Component)this).repaint();
  584.       }
  585.  
  586.    }
  587.  
  588.    public synchronized void insertItems(int var1, Vector var2, Image var3, boolean var4) {
  589.       int var5 = var2.size();
  590.       boolean var6 = false;
  591.       if (this.validIndex(var1)) {
  592.          for(int var7 = 0; var7 < var5; ++var7) {
  593.             this.items.insertElementAt(new ListItem(var3, (String)var2.elementAt(var7), var4, this.field_0, this.bCellBorders), var1++);
  594.          }
  595.       } else {
  596.          for(int var8 = 0; var8 < var5; ++var8) {
  597.             this.items.addElement(new ListItem(var3, (String)var2.elementAt(var8), var4, this.field_0, this.bCellBorders));
  598.          }
  599.       }
  600.  
  601.       this.deselectAll();
  602.       this.bAllDirty = true;
  603.       this.updateWidths(this.field_0);
  604.       if (!this.bInternalBlockPaint) {
  605.          ((Component)this).repaint();
  606.       }
  607.  
  608.    }
  609.  
  610.    public int countItems() {
  611.       return this.items.size();
  612.    }
  613.  
  614.    public String getItem(int var1) {
  615.       return this.validIndex(var1) ? ((ListItem)this.items.elementAt(var1)).sText : null;
  616.    }
  617.  
  618.    public Image getImage(int var1) {
  619.       return this.validIndex(var1) ? ((ListItem)this.items.elementAt(var1)).image : null;
  620.    }
  621.  
  622.    public void changeImage(int var1, Image var2) {
  623.       if (this.validIndex(var1)) {
  624.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  625.          var3.image = var2;
  626.          var3.bDirty = true;
  627.          if (!this.bInternalBlockPaint) {
  628.             ((Component)this).repaint();
  629.          }
  630.       }
  631.  
  632.    }
  633.  
  634.    public void changeText(int var1, String var2) {
  635.       if (this.validIndex(var1)) {
  636.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  637.          var3.sText = var2;
  638.          var3.bDirty = true;
  639.          var3.updateWidth(this.field_0);
  640.          this.updateWidth(var3);
  641.          if (!this.bInternalBlockPaint) {
  642.             ((Component)this).repaint();
  643.          }
  644.       }
  645.  
  646.    }
  647.  
  648.    public void setEdited(int var1, boolean var2) {
  649.       if (this.validIndex(var1)) {
  650.          ListItem var3 = (ListItem)this.items.elementAt(var1);
  651.          var3.bEdited = var2;
  652.       }
  653.  
  654.    }
  655.  
  656.    public boolean getEdited(int var1) {
  657.       if (this.validIndex(var1)) {
  658.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  659.          return var2.bEdited;
  660.       } else {
  661.          return false;
  662.       }
  663.    }
  664.  
  665.    public void enable(int var1) {
  666.       if (this.validIndex(var1)) {
  667.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  668.          if (!var2.bEnabled) {
  669.             var2.bEnabled = true;
  670.             var2.bDirty = true;
  671.             if (!this.bInternalBlockPaint) {
  672.                ((Component)this).repaint();
  673.             }
  674.          }
  675.       }
  676.  
  677.    }
  678.  
  679.    public void disable(int var1) {
  680.       if (this.validIndex(var1)) {
  681.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  682.          if (var2.bEnabled) {
  683.             var2.bEnabled = false;
  684.             var2.bDirty = true;
  685.             this.deselect(var1);
  686.             if (!this.bInternalBlockPaint) {
  687.                ((Component)this).repaint();
  688.             }
  689.          }
  690.       }
  691.  
  692.    }
  693.  
  694.    public void enable(int var1, boolean var2) {
  695.       if (var2) {
  696.          this.enable(var1);
  697.       } else {
  698.          this.disable(var1);
  699.       }
  700.    }
  701.  
  702.    public boolean isEnabled(int var1) {
  703.       if (this.validIndex(var1)) {
  704.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  705.          return var2.bEnabled;
  706.       } else {
  707.          return false;
  708.       }
  709.    }
  710.  
  711.    public synchronized void clear() {
  712.       this.items = new Vector();
  713.       this.nTopRow = 0;
  714.       this.visibleIndex = -1;
  715.       this.lastDownModifiers = -1;
  716.       this.lastSelected = -1;
  717.       this.lastIndex = -1;
  718.       this.lastTempIndex = -1;
  719.       this.countSelected = 0;
  720.       this.prevSelectTime = -1L;
  721.       this.prevSelectRow = -1L;
  722.       this.VBar.setValues(1, 1, 0, 2);
  723.       this.VBar.hide();
  724.       this.bVBarVisible = false;
  725.       this.HBar.setValues(1, 1, 0, 2);
  726.       this.HBar.hide();
  727.       this.bHBarVisible = false;
  728.       this.bAllDirty = true;
  729.       this.bInternalBlockPaint = false;
  730.       this.bBlockPaint = false;
  731.       this.longestLineValue = 0;
  732.       this.xCoord = 0;
  733.       ((Component)this).repaint();
  734.    }
  735.  
  736.    public synchronized void delItem(int var1) {
  737.       if (this.validIndex(var1)) {
  738.          this.deselect(var1);
  739.          this.items.removeElementAt(var1);
  740.          this.bAllDirty = true;
  741.          this.scrollVertical(this.nTopRow, true);
  742.          this.updateWidths((FontMetrics)null);
  743.          if (!this.bInternalBlockPaint) {
  744.             ((Component)this).repaint();
  745.          }
  746.       }
  747.  
  748.    }
  749.  
  750.    public synchronized void delItems(int var1, int var2) {
  751.       int var3 = this.items.size();
  752.       if (var3 > 0) {
  753.          if (var2 >= var3) {
  754.             var2 = var3 - 1;
  755.          }
  756.  
  757.          if (var1 < 0) {
  758.             var1 = 0;
  759.          }
  760.  
  761.          if (var1 <= var2) {
  762.             this.bInternalBlockPaint = true;
  763.  
  764.             for(int var4 = var2; var4 >= var1; --var4) {
  765.                this.deselect(var4);
  766.                this.items.removeElementAt(var4);
  767.             }
  768.  
  769.             this.bInternalBlockPaint = false;
  770.             this.bAllDirty = true;
  771.             this.scrollVertical(this.nTopRow, true);
  772.             this.updateWidths((FontMetrics)null);
  773.             ((Component)this).repaint();
  774.          }
  775.       }
  776.  
  777.    }
  778.  
  779.    public synchronized void delSelectedItems() {
  780.       int var1 = this.items.size();
  781.       this.bInternalBlockPaint = true;
  782.       int var2 = 0;
  783.  
  784.       while(var2 < var1) {
  785.          ListItem var3 = (ListItem)this.items.elementAt(var2);
  786.          if (var3.bSelected) {
  787.             this.deselect(var2);
  788.             this.items.removeElementAt(var2);
  789.             --var1;
  790.          } else {
  791.             ++var2;
  792.          }
  793.       }
  794.  
  795.       this.bAllDirty = true;
  796.       this.scrollVertical(this.nTopRow, true);
  797.       this.updateWidths((FontMetrics)null);
  798.       this.bInternalBlockPaint = false;
  799.       ((Component)this).repaint();
  800.    }
  801.  
  802.    public synchronized int getSelectedIndex() {
  803.       return this.lastSelected;
  804.    }
  805.  
  806.    public synchronized int[] getSelectedIndexes() {
  807.       int[] var1 = new int[this.countSelected];
  808.       if (this.countSelected == 1) {
  809.          var1[0] = this.lastSelected;
  810.       } else if (this.countSelected > 1) {
  811.          int var2 = 0;
  812.          int var3 = this.items.size();
  813.  
  814.          for(int var4 = 0; var4 < var3; ++var4) {
  815.             ListItem var5 = (ListItem)this.items.elementAt(var4);
  816.             if (var5.bSelected) {
  817.                var1[var2++] = var4;
  818.                if (var2 == this.countSelected) {
  819.                   break;
  820.                }
  821.             }
  822.          }
  823.       }
  824.  
  825.       return var1;
  826.    }
  827.  
  828.    public synchronized String getSelectedItem() {
  829.       return this.lastSelected < 0 ? null : this.getItem(this.lastSelected);
  830.    }
  831.  
  832.    public synchronized String[] getSelectedItems() {
  833.       String[] var1 = new String[this.countSelected];
  834.       if (!this.bMultipleSelections) {
  835.          if (this.lastSelected != -1) {
  836.             ListItem var2 = (ListItem)this.items.elementAt(this.lastSelected);
  837.             var1[0] = var2.sText;
  838.          }
  839.       } else if (this.countSelected > 0) {
  840.          int var3 = 0;
  841.          int var4 = this.items.size();
  842.  
  843.          for(int var5 = 0; var5 < var4; ++var5) {
  844.             ListItem var6 = (ListItem)this.items.elementAt(var5);
  845.             if (var6.bSelected) {
  846.                var1[var3] = var6.sText;
  847.                ++var3;
  848.                if (var3 == this.countSelected) {
  849.                   break;
  850.                }
  851.             }
  852.          }
  853.       }
  854.  
  855.       return var1;
  856.    }
  857.  
  858.    public synchronized String getLabel() {
  859.       return new String(this.ilbLabel);
  860.    }
  861.  
  862.    public synchronized void select(int var1) {
  863.       if (this.isEnabled(var1)) {
  864.          Object var2 = null;
  865.          if (this.bMultipleSelections) {
  866.             int var3 = this.items.size();
  867.  
  868.             for(int var4 = 0; var4 < var3; ++var4) {
  869.                ListItem var6 = (ListItem)this.items.elementAt(var4);
  870.                if (var4 == var1) {
  871.                   if (!var6.bSelected) {
  872.                      var6.bSelected = true;
  873.                      var6.bDirty = true;
  874.                   }
  875.                } else if (var6.bSelected) {
  876.                   var6.bSelected = false;
  877.                   var6.bDirty = true;
  878.                }
  879.             }
  880.          } else if (this.lastSelected != var1) {
  881.             if (this.lastSelected != -1) {
  882.                this.deselect(this.lastSelected);
  883.             }
  884.  
  885.             ListItem var5 = (ListItem)this.items.elementAt(var1);
  886.             var5.bSelected = true;
  887.             var5.bDirty = true;
  888.          }
  889.  
  890.          this.lastSelected = var1;
  891.          this.countSelected = 1;
  892.          this.makeVisible(var1);
  893.       }
  894.  
  895.    }
  896.  
  897.    public synchronized void select(String var1) {
  898.       int var3 = this.items.size();
  899.  
  900.       for(int var4 = 0; var4 < var3; ++var4) {
  901.          ListItem var2 = (ListItem)this.items.elementAt(var4);
  902.          if (var2.sText.equals(var1)) {
  903.             if (var2.bEnabled) {
  904.                this.select(var4);
  905.             }
  906.  
  907.             return;
  908.          }
  909.       }
  910.  
  911.    }
  912.  
  913.    public synchronized void selectMultiple(int var1, boolean var2, boolean var3) {
  914.       if (!this.bMultipleSelections) {
  915.          var2 = false;
  916.          var3 = false;
  917.       }
  918.  
  919.       if (var2) {
  920.          this.shiftSelect(var1, var3);
  921.       } else if (var3) {
  922.          this.ctrlSelect(var1);
  923.       } else {
  924.          this.select(var1);
  925.       }
  926.    }
  927.  
  928.    public synchronized void selectAll() {
  929.       if (this.bMultipleSelections) {
  930.          int var1 = this.items.size();
  931.  
  932.          for(int var3 = 0; var3 < var1; ++var3) {
  933.             ListItem var2 = (ListItem)this.items.elementAt(var3);
  934.             if (var2.bEnabled) {
  935.                var2.bSelected = true;
  936.             }
  937.          }
  938.  
  939.          this.countSelected = var1;
  940.          this.lastSelected = var1 - 1;
  941.          ((Component)this).repaint();
  942.       }
  943.    }
  944.  
  945.    public synchronized void deselect(int var1) {
  946.       if (this.validIndex(var1)) {
  947.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  948.          if (var2.bSelected) {
  949.             if (this.lastSelected == var1) {
  950.                this.lastSelected = -1;
  951.             }
  952.  
  953.             var2.bSelected = false;
  954.             var2.bDirty = true;
  955.             --this.countSelected;
  956.             if (!this.bInternalBlockPaint) {
  957.                ((Component)this).repaint();
  958.             }
  959.          }
  960.       }
  961.  
  962.    }
  963.  
  964.    public synchronized void deselectAll() {
  965.       if (!this.bMultipleSelections) {
  966.          if (this.lastSelected != -1) {
  967.             ListItem var1 = (ListItem)this.items.elementAt(this.lastSelected);
  968.             var1.bSelected = false;
  969.             var1.bDirty = true;
  970.          }
  971.       } else {
  972.          int var2 = this.items.size();
  973.  
  974.          for(int var3 = 0; var3 < var2; ++var3) {
  975.             ListItem var4 = (ListItem)this.items.elementAt(var3);
  976.             if (var4.bSelected) {
  977.                var4.bSelected = false;
  978.                var4.bDirty = true;
  979.             }
  980.          }
  981.       }
  982.  
  983.       this.lastSelected = -1;
  984.       this.countSelected = 0;
  985.       ((Component)this).repaint();
  986.    }
  987.  
  988.    public synchronized boolean isSelected(int var1) {
  989.       if (this.validIndex(var1)) {
  990.          ListItem var2 = (ListItem)this.items.elementAt(var1);
  991.          return var2.bSelected;
  992.       } else {
  993.          return false;
  994.       }
  995.    }
  996.  
  997.    public int getRows() {
  998.       return this.visibleRows;
  999.    }
  1000.  
  1001.    public boolean allowsMultipleSelections() {
  1002.       return this.bMultipleSelections;
  1003.    }
  1004.  
  1005.    public void setMultipleSelections(boolean var1) {
  1006.       if (var1 != this.bMultipleSelections) {
  1007.          if (!var1) {
  1008.             this.deselectAll();
  1009.          }
  1010.  
  1011.          this.bMultipleSelections = var1;
  1012.       }
  1013.  
  1014.    }
  1015.  
  1016.    public int getVisibleIndex() {
  1017.       return this.visibleIndex;
  1018.    }
  1019.  
  1020.    public synchronized void makeVisible(int var1) {
  1021.       this.visibleIndex = var1;
  1022.       if (this.nTopRow > var1) {
  1023.          this.scrollVertical(var1, true);
  1024.       } else {
  1025.          if (var1 >= this.nTopRow + this.visibleRows) {
  1026.             this.scrollVertical(var1 - this.visibleRows + 1, true);
  1027.          }
  1028.  
  1029.       }
  1030.    }
  1031.  
  1032.    public void setTopRow(int var1) {
  1033.       int var2 = this.items.size();
  1034.       if (var2 < this.visibleRows) {
  1035.          var1 = 0;
  1036.       } else if (var1 > var2 - this.visibleRows) {
  1037.          var1 = var2 - this.visibleRows;
  1038.       }
  1039.  
  1040.       if (this.nTopRow != var1) {
  1041.          this.nTopRow = var1;
  1042.          this.bAllDirty = true;
  1043.          ((Component)this).invalidate();
  1044.       }
  1045.  
  1046.    }
  1047.  
  1048.    public Dimension preferredSize(int var1) {
  1049.       Dimension var2 = this.minimumSize(var1);
  1050.       Dimension var3 = ((Component)this).size();
  1051.       return new Dimension(Math.max(var2.width, var3.width), Math.max(var2.height, var3.height));
  1052.    }
  1053.  
  1054.    public Dimension preferredSize() {
  1055.       return this.rowsToShow > 0 ? this.preferredSize(this.rowsToShow) : this.preferredSize(this.items.size());
  1056.    }
  1057.  
  1058.    public Dimension minimumSize(int var1) {
  1059.       this.font = ((Component)this).getFont();
  1060.       if (this.font != null) {
  1061.          this.field_0 = ((Component)this).getFontMetrics(this.font);
  1062.          if (this.field_0 != null) {
  1063.             this.fontHeight = this.field_0.getHeight();
  1064.             if (this.bCellBorders) {
  1065.                this.cellHt = this.fontHeight + 5;
  1066.             } else {
  1067.                this.cellHt = this.fontHeight + 1;
  1068.             }
  1069.  
  1070.             return new Dimension(this.field_0.stringWidth("WN") * this.colsToShow / 2 + 6, var1 * this.cellHt + this.borderWidth + 4);
  1071.          }
  1072.       }
  1073.  
  1074.       return new Dimension(this.borderWidth + 6, this.borderWidth + 4);
  1075.    }
  1076.  
  1077.    public Dimension minimumSize() {
  1078.       return this.rowsToShow > 0 ? this.minimumSize(this.rowsToShow) : this.minimumSize(this.items.size());
  1079.    }
  1080.  
  1081.    public void addNotify() {
  1082.       super.addNotify();
  1083.       this.font = ((Component)this).getFont();
  1084.       this.field_0 = ((Component)this).getFontMetrics(this.font);
  1085.       this.fontHeight = this.field_0.getHeight();
  1086.       this.updateWidths(this.field_0);
  1087.    }
  1088.  
  1089.    public synchronized void setColumns(int var1) {
  1090.       if (this.colsToShow != var1) {
  1091.          this.colsToShow = var1;
  1092.          ((Component)this).invalidate();
  1093.       }
  1094.  
  1095.    }
  1096.  
  1097.    public synchronized void blockPaint(boolean var1) {
  1098.       this.bBlockPaint = var1;
  1099.       if (!this.bBlockPaint) {
  1100.          ((Component)this).repaint();
  1101.       }
  1102.  
  1103.    }
  1104.  
  1105.    public synchronized void setFont(Font var1) {
  1106.       if (var1 != null) {
  1107.          super.setFont(var1);
  1108.          this.field_0 = ((Component)this).getFontMetrics(var1);
  1109.          this.updateWidths(this.field_0);
  1110.          this.xCoord = 0;
  1111.          if (this.bOsFlag) {
  1112.             this.bAllDirty = true;
  1113.             ((Component)this).invalidate();
  1114.          }
  1115.  
  1116.       }
  1117.    }
  1118.  
  1119.    public synchronized void setListBoxFont(Font var1) {
  1120.       this.setFont(var1);
  1121.    }
  1122.  
  1123.    public synchronized Font getListBoxFont() {
  1124.       return super.getFont();
  1125.    }
  1126.  
  1127.    public synchronized void scrollVertical(int var1, boolean var2) {
  1128.       int var3 = this.nTopRow;
  1129.       if (this.visibleRows == 0) {
  1130.          var3 = 0;
  1131.       } else {
  1132.          if (var2) {
  1133.             var3 = var1;
  1134.          } else {
  1135.             switch (var1) {
  1136.                case 601:
  1137.                   --var3;
  1138.                   break;
  1139.                case 602:
  1140.                   ++var3;
  1141.                   break;
  1142.                case 603:
  1143.                   var3 -= this.visibleRows;
  1144.                   break;
  1145.                case 604:
  1146.                   var3 += this.visibleRows;
  1147.             }
  1148.          }
  1149.  
  1150.          if (var3 < 0) {
  1151.             var3 = 0;
  1152.          } else if (var3 > this.items.size() - this.visibleRows) {
  1153.             var3 = this.items.size() - this.visibleRows;
  1154.             if (var3 < 0) {
  1155.                var3 = 0;
  1156.             }
  1157.          }
  1158.       }
  1159.  
  1160.       if (this.nTopRow != var3) {
  1161.          this.nTopRow = var3;
  1162.          this.VBar.setValue(var3);
  1163.          this.bAllDirty = true;
  1164.          if (!this.bInternalBlockPaint) {
  1165.             ((Component)this).repaint();
  1166.          }
  1167.       }
  1168.  
  1169.    }
  1170.  
  1171.    public synchronized void scrollHorizontal(int var1, boolean var2) {
  1172.       int var3 = this.xCoord;
  1173.       if (var2) {
  1174.          var3 = -var1;
  1175.       } else {
  1176.          switch (var1) {
  1177.             case 601:
  1178.                ++var3;
  1179.                break;
  1180.             case 602:
  1181.                --var3;
  1182.                break;
  1183.             case 603:
  1184.                var3 += this.lWidth;
  1185.                break;
  1186.             case 604:
  1187.                var3 -= this.lWidth;
  1188.          }
  1189.       }
  1190.  
  1191.       if (var3 > 0) {
  1192.          var3 = 0;
  1193.       } else if (-var3 > this.HBar.getMaximum()) {
  1194.          var3 = -this.HBar.getMaximum();
  1195.       }
  1196.  
  1197.       if (this.xCoord != var3) {
  1198.          this.xCoord = var3;
  1199.          this.HBar.setValue(-var3);
  1200.          this.bAllDirty = true;
  1201.          if (!this.bInternalBlockPaint) {
  1202.             ((Component)this).repaint();
  1203.          }
  1204.       }
  1205.  
  1206.    }
  1207.  
  1208.    public synchronized void update(Graphics var1) {
  1209.       if (!this.bBlockPaint && !this.bInternalBlockPaint) {
  1210.          this.paint(var1);
  1211.       }
  1212.  
  1213.    }
  1214.  
  1215.    public synchronized void paint(Graphics var1) {
  1216.       int var8 = 0;
  1217.       int var9 = 0;
  1218.       byte var10 = 0;
  1219.       int var11 = 0;
  1220.       int var12 = 0;
  1221.       boolean var13 = false;
  1222.       boolean var14 = false;
  1223.       Rectangle var15 = ((Component)this).bounds();
  1224.       this.font = var1.getFont();
  1225.       this.field_0 = var1.getFontMetrics(this.font);
  1226.       this.fontHeight = this.field_0.getHeight();
  1227.       this.fontDescent = this.field_0.getDescent();
  1228.       int var3 = this.items.size();
  1229.       if (this.bCellBorders) {
  1230.          this.cellHt = this.fontHeight + 5;
  1231.       } else {
  1232.          this.cellHt = this.fontHeight + 1;
  1233.       }
  1234.  
  1235.       if (var3 == 0) {
  1236.          this.nTopRow = 0;
  1237.          this.visibleRows = 0;
  1238.          var14 = false;
  1239.          var13 = false;
  1240.          this.xCoord = 0;
  1241.       } else {
  1242.          if (this.bAllowShowHBar && this.longestLineValue > var15.width - this.borderWidth) {
  1243.             var14 = true;
  1244.             var9 = this.barSize;
  1245.          } else {
  1246.             var14 = false;
  1247.             var9 = 0;
  1248.          }
  1249.  
  1250.          int var7 = (var15.height - var9 - this.borderWidth - 4) / this.cellHt;
  1251.          if (this.bAllowShowVBar && var3 > var7) {
  1252.             var13 = true;
  1253.             var8 = this.barSize;
  1254.             if (!var14 && this.bAllowShowHBar && this.longestLineValue > var15.width - this.borderWidth - var8) {
  1255.                var14 = true;
  1256.                var9 = this.barSize;
  1257.                var7 = (var15.height - var9 - this.borderWidth - 4) / this.cellHt;
  1258.             }
  1259.          } else {
  1260.             var13 = false;
  1261.             var8 = 0;
  1262.          }
  1263.  
  1264.          if (this.visibleRows != var7) {
  1265.             this.visibleRows = var7;
  1266.             this.bAllDirty = true;
  1267.          }
  1268.  
  1269.          if (var13) {
  1270.             this.VBar.reshape(var15.width - this.barSize - this.halfBorderWidth, this.halfBorderWidth, this.barSize, var15.height - this.borderWidth - var9);
  1271.             this.VBar.setValues(this.nTopRow, this.visibleRows, 0, var3 - this.visibleRows);
  1272.             this.VBar.setPageIncrement(this.visibleRows);
  1273.             this.lWidth = var15.width - var8 - this.borderWidth;
  1274.             if (!this.bVBarVisible) {
  1275.                this.bVBarVisible = true;
  1276.                this.VBar.show();
  1277.             }
  1278.          } else {
  1279.             this.lWidth = var15.width - this.borderWidth;
  1280.             if (this.bVBarVisible) {
  1281.                this.bVBarVisible = false;
  1282.                this.VBar.hide();
  1283.             }
  1284.          }
  1285.  
  1286.          if (var14) {
  1287.             this.HBar.reshape(this.halfBorderWidth, var15.height - this.barSize - this.halfBorderWidth, var15.width - this.borderWidth - var8, this.barSize);
  1288.             this.HBar.setValues(-this.xCoord, this.lWidth, 0, this.longestLineValue - this.lWidth);
  1289.             this.HBar.setPageIncrement(this.lWidth);
  1290.             if (!this.bHBarVisible) {
  1291.                this.bHBarVisible = true;
  1292.                this.HBar.show();
  1293.             }
  1294.          } else if (this.bHBarVisible) {
  1295.             this.bHBarVisible = false;
  1296.             this.HBar.hide();
  1297.          }
  1298.       }
  1299.  
  1300.       if (var3 == 0 || this.bAllDirty) {
  1301.          var1.clearRect(this.halfBorderWidth, this.halfBorderWidth, var15.width - this.borderWidth, var15.height - this.borderWidth);
  1302.       }
  1303.  
  1304.       if (this.borderType == 0) {
  1305.          var1.setColor(Color.black);
  1306.          var1.drawLine(0, 0, var15.width - 2, 0);
  1307.          var1.drawLine(0, 0, 0, var15.height - 2);
  1308.          var1.setColor(Color.gray);
  1309.          var1.drawLine(1, 1, var15.width - 3, 1);
  1310.          var1.drawLine(1, 1, 1, var15.height - 3);
  1311.          var1.setColor(Color.lightGray);
  1312.          var1.drawLine(1, var15.height - 2, var15.width - 2, var15.height - 2);
  1313.          var1.drawLine(var15.width - 2, 1, var15.width - 2, var15.height - 3);
  1314.          var1.setColor(Color.white);
  1315.          var1.drawLine(0, var15.height - 1, var15.width - 1, var15.height - 1);
  1316.          var1.drawLine(var15.width - 1, 0, var15.width - 1, var15.height - 1);
  1317.       }
  1318.  
  1319.       var1.clipRect(this.halfBorderWidth, this.halfBorderWidth, this.lWidth, var15.height - this.halfBorderWidth);
  1320.       if (this.nTopRow >= var3) {
  1321.          this.nTopRow -= this.visibleRows + 1;
  1322.       }
  1323.  
  1324.       int var5 = this.nTopRow;
  1325.       int var6 = Math.min(this.nTopRow + this.visibleRows, var3);
  1326.  
  1327.       for(int var16 = 0; var5 < var6; ++var16) {
  1328.          var11 = var16 * this.cellHt + this.yAdj;
  1329.          var12 = (var16 + 1) * this.cellHt + this.yAdj;
  1330.          ListItem var2 = (ListItem)this.items.elementAt(var5);
  1331.          if (var2.bDirty || this.bAllDirty) {
  1332.             var2.bDirty = false;
  1333.             var1.clearRect(this.halfBorderWidth, var11, this.lWidth, this.cellHt);
  1334.          }
  1335.  
  1336.          int var4;
  1337.          if (var2.image != null) {
  1338.             var4 = this.halfBorderWidth + 19 + 2;
  1339.          } else {
  1340.             var4 = this.halfBorderWidth;
  1341.          }
  1342.  
  1343.          if (var2.bCellBorder) {
  1344.             var10 = 2;
  1345.          } else {
  1346.             var10 = 0;
  1347.          }
  1348.  
  1349.          if (var2.bSelected) {
  1350.             var1.drawImage(this.SelectImage, this.xCoord + var4 + var10, var11, this.lWidth - this.xCoord, this.cellHt, this);
  1351.             var1.setColor(Color.white);
  1352.          } else if (var2.bEnabled) {
  1353.             if (var2.color == null) {
  1354.                var1.setColor(this.enabledColor);
  1355.             } else {
  1356.                var1.setColor(var2.color);
  1357.             }
  1358.          } else {
  1359.             var1.setColor(this.disabledColor);
  1360.          }
  1361.  
  1362.          var1.drawString(var2.sText, this.xCoord + var4 + var10, var12 - this.fontDescent);
  1363.          if (var2.image != null) {
  1364.             var1.drawImage(var2.image, this.xCoord + this.halfBorderWidth + var10 + 2, var11 + 2, 19, this.cellHt - 3, this);
  1365.          }
  1366.  
  1367.          if (var2.bCellBorder) {
  1368.             var1.setColor(var2.cellBorderColor);
  1369.             var1.drawRect(this.halfBorderWidth, var11, this.lWidth, this.cellHt);
  1370.          }
  1371.  
  1372.          ++var5;
  1373.       }
  1374.  
  1375.       this.extraPaint(var1, var15);
  1376.       this.bAllDirty = false;
  1377.    }
  1378.  
  1379.    public void extraPaint(Graphics var1, Rectangle var2) {
  1380.    }
  1381.  
  1382.    public synchronized void show() {
  1383.       this.bAllDirty = true;
  1384.       super.show();
  1385.    }
  1386.  
  1387.    public synchronized void reshape(int var1, int var2, int var3, int var4) {
  1388.       this.bAllDirty = true;
  1389.       super.reshape(var1, var2, var3, var4);
  1390.    }
  1391.  
  1392.    public synchronized void setDirty() {
  1393.       this.bAllDirty = true;
  1394.    }
  1395.  
  1396.    public boolean allSelected() {
  1397.       return this.countSelected == this.items.size();
  1398.    }
  1399.  
  1400.    public void setDirectNotify(boolean var1) {
  1401.       this.bDirectNotify = var1;
  1402.    }
  1403.  
  1404.    protected boolean validIndex(int var1) {
  1405.       return var1 >= 0 && var1 < this.items.size();
  1406.    }
  1407.  
  1408.    protected boolean isVisibleIndex(int var1) {
  1409.       return var1 >= this.nTopRow && var1 < this.nTopRow + this.visibleRows;
  1410.    }
  1411.  
  1412.    protected String paramString() {
  1413.       return super.paramString() + ", selected=" + this.getSelectedItem();
  1414.    }
  1415.  
  1416.    protected void shiftSelect(int var1, boolean var2) {
  1417.       int var3 = 0;
  1418.       int var4 = 0;
  1419.       if (this.lastSelected == -1) {
  1420.          this.select(var1);
  1421.       } else if (this.lastSelected == var1) {
  1422.          if (!var2) {
  1423.             this.bInternalBlockPaint = true;
  1424.             this.select(var1);
  1425.             this.bInternalBlockPaint = false;
  1426.          }
  1427.       } else if (this.lastSelected < var1) {
  1428.          if (!this.isEnabled(var1)) {
  1429.             return;
  1430.          }
  1431.  
  1432.          if (var2) {
  1433.             var3 = this.lastSelected + 1;
  1434.             var4 = Math.min(this.items.size(), var1 + 1);
  1435.          } else {
  1436.             var3 = 0;
  1437.             var4 = this.items.size();
  1438.          }
  1439.  
  1440.          for(; var3 < var4; ++var3) {
  1441.             ListItem var5 = (ListItem)this.items.elementAt(var3);
  1442.             if (var3 >= this.lastSelected && var3 <= var1) {
  1443.                if (!var5.bSelected) {
  1444.                   var5.bDirty = true;
  1445.                   var5.bSelected = true;
  1446.                   ++this.countSelected;
  1447.                }
  1448.             } else if (var5.bSelected) {
  1449.                var5.bDirty = true;
  1450.                var5.bSelected = false;
  1451.                --this.countSelected;
  1452.             }
  1453.          }
  1454.       } else if (this.lastSelected > var1) {
  1455.          if (!this.isEnabled(var1)) {
  1456.             return;
  1457.          }
  1458.  
  1459.          if (var2) {
  1460.             var4 = Math.min(this.items.size(), this.lastSelected);
  1461.          } else {
  1462.             var3 = 0;
  1463.             var4 = this.items.size();
  1464.          }
  1465.  
  1466.          for(int var8 = 0; var8 < var4; ++var8) {
  1467.             ListItem var11 = (ListItem)this.items.elementAt(var8);
  1468.             if (var8 >= var1 && var8 <= this.lastSelected) {
  1469.                if (!var11.bSelected) {
  1470.                   var11.bDirty = true;
  1471.                   var11.bSelected = true;
  1472.                   ++this.countSelected;
  1473.                }
  1474.             } else if (var11.bSelected) {
  1475.                var11.bDirty = true;
  1476.                var11.bSelected = false;
  1477.                --this.countSelected;
  1478.             }
  1479.          }
  1480.       }
  1481.  
  1482.       if (!this.bInternalBlockPaint) {
  1483.          ((Component)this).repaint();
  1484.       }
  1485.  
  1486.    }
  1487.  
  1488.    protected void ctrlSelect(int var1) {
  1489.       ListItem var2 = (ListItem)this.items.elementAt(var1);
  1490.       if (var2.bEnabled) {
  1491.          if (var2.bSelected) {
  1492.             var2.bSelected = false;
  1493.             --this.countSelected;
  1494.             this.lastSelected = -1;
  1495.          } else {
  1496.             var2.bSelected = true;
  1497.             ++this.countSelected;
  1498.             this.lastSelected = var1;
  1499.          }
  1500.  
  1501.          var2.bDirty = true;
  1502.          if (!this.bInternalBlockPaint) {
  1503.             ((Component)this).repaint();
  1504.          }
  1505.  
  1506.       }
  1507.    }
  1508.  
  1509.    protected int mouseCalcIndex(int var1) {
  1510.       int var2;
  1511.       if (var1 < this.yAdj) {
  1512.          var2 = this.nTopRow - 1;
  1513.       } else {
  1514.          var2 = (var1 - this.yAdj) / this.cellHt + this.nTopRow;
  1515.       }
  1516.  
  1517.       if (var2 >= this.items.size()) {
  1518.          var2 = -1;
  1519.       } else if (var2 < 0) {
  1520.          var2 = 0;
  1521.       }
  1522.  
  1523.       return var2;
  1524.    }
  1525.  
  1526.    private void updateWidth(ListItem var1) {
  1527.       int var2 = var1.lineWidth + 6;
  1528.       if (var1.image != null) {
  1529.          var2 += 19;
  1530.       }
  1531.  
  1532.       if (var2 > this.longestLineValue) {
  1533.          this.longestLineValue = var2;
  1534.       }
  1535.  
  1536.    }
  1537.  
  1538.    private void updateWidths(FontMetrics var1) {
  1539.       this.longestLineValue = 0;
  1540.       int var2 = this.items.size();
  1541.       int var3 = 0;
  1542.  
  1543.       for(int var5 = 0; var5 < var2; ++var5) {
  1544.          ListItem var4 = (ListItem)this.items.elementAt(var5);
  1545.          var4.updateWidth(var1);
  1546.          var3 = var4.lineWidth + 6;
  1547.          if (var4.image != null) {
  1548.             var3 += 19;
  1549.          }
  1550.  
  1551.          if (var3 > this.longestLineValue) {
  1552.             this.longestLineValue = var3;
  1553.          }
  1554.       }
  1555.  
  1556.    }
  1557.  
  1558.    private void notifyParent(Event var1, int var2, boolean var3) {
  1559.       Object var4 = null;
  1560.       if (this.ilbParent != null) {
  1561.          var4 = this.ilbParent;
  1562.       } else if (this.bDirectNotify) {
  1563.          var4 = ((Component)this).getParent();
  1564.       }
  1565.  
  1566.       if (var4 == null) {
  1567.          var4 = this;
  1568.       }
  1569.  
  1570.       if (var3) {
  1571.          ((Component)var4).postEvent(new Event(this, var1.when, 1001, var1.x, var1.y, var1.key, this.lastDownModifiers, this.getSelectedItem()));
  1572.       } else {
  1573.          if (var1.x >= 0 && var1.x - this.xCoord < 19) {
  1574.             ListItem var5 = (ListItem)this.items.elementAt(var2);
  1575.             if (var5.image != null) {
  1576.                ((Component)var4).postEvent(new Event(this, var1.when, 16388, var1.x, var1.y, var1.key, this.lastDownModifiers, new Integer(var2)));
  1577.             }
  1578.          }
  1579.  
  1580.          ((Component)var4).postEvent(new Event(this, var1.when, 701, var1.x, var1.y, var1.key, this.lastDownModifiers, new Integer(var2)));
  1581.       }
  1582.    }
  1583.  
  1584.    private int keyCalcIndex(int var1, boolean var2) {
  1585.       if (var2) {
  1586.          this.lastIndex = var1;
  1587.       } else {
  1588.          this.lastIndex += var1;
  1589.       }
  1590.  
  1591.       if (this.lastIndex >= this.items.size()) {
  1592.          this.lastIndex = this.items.size() - 1;
  1593.       } else if (this.lastIndex < 0) {
  1594.          this.lastIndex = 0;
  1595.       }
  1596.  
  1597.       return this.lastIndex;
  1598.    }
  1599. }
  1600.